#ifndef _C_IMAGE_H_
#define _C_IMAGE_H_

#include "CResource.h"
#include "types/types.h"

//----------------------------------------------
enum EImageType
{
	E_NOT_A_VALID_IMAGE_TYPE = 0,
	E_JPEG,
};

//----------------------------------------------
class CImage : public CResource
{
public:
	CImage();
	~CImage();

	static EImageType	getImageType		(const xstring& sPath);
	bool				load				(const xstring& sPath, EImageType eType);
	void				unload				();
	void				createBuffer		(int iWidth, int iHeight);
	void				releaseBuffer		();
	byte*				getBuffer			() const { return m_pBuffer; }
	int					getWidth			() const { return m_iWidth; }
	int					getHeight			() const { return m_iHeight; }

	void*		m_pDeviceData;

private:
	int			m_iWidth;
	int			m_iHeight;
	byte*		m_pBuffer;
	int			m_iBufferSize;
};

//----------------------------------------------
class CImagePool
{
public:
	typedef TStaticQueue<CImage*, NB_MAX_LOADED_IMAGES> TImagePool;

	CImagePool();

	bool	loadNewImage	(CFileInfo& oInfo);

	static const int s_iNbLoadedImages = 3;

	TImagePool	m_oImages;
	float		m_fCurrentImageStartTime;
};

#endif
